﻿
    using System;
namespace YoucaiReader.Helper.Drawing
{
    public sealed class FontFactoryImpl : FontFactory
    {
        private static readonly int DefaultFontIndex = 1;
        private static readonly int DefaultFontSizeIndex = 2;
        internal static readonly string[] FontFamilyNames = new string[] { "Courier New", "Georgia", "Arial" };
        private static FontInfo fontInfo = new FontInfo(null);
        private static FontFactoryImpl instance = new FontFactoryImpl();
        private static readonly int MonoSpaceFontIndex = 0;
        internal static readonly int[] SIZES = new int[] { 15, 0x12, 0x15, 0x18, 0x1b, 30, 0x21, 0x24 };

        private FontFactoryImpl()
        {
        }

        public string[] getAvailableFamilyNames()
        {
            return FontFamilyNames;
        }

        public string getDefaultFamilyName()
        {
            return FontFamilyNames[DefaultFontIndex];
        }

        public int getDefaultFontSize()
        {
            return SIZES[DefaultFontSizeIndex];
        }

        public Font getFont(string familyName, int size, bool bold, bool italic, bool underlined)
        {
            return new FontImpl(fontInfo, familyName, size, bold, italic, underlined);
        }

        public string getMonospacedFontFamilyName()
        {
            return FontFamilyNames[MonoSpaceFontIndex];
        }

        public static FontFactoryImpl Instance
        {
            get
            {
                return instance;
            }
        }
    }
}

